While merging my development tree with the latest hg tree I noticed that
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 1 Aug 2005 09:16:25 +0000 (09:16 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 1 Aug 2005 09:16:25 +0000 (09:16 +0000)
VMX support was broken. When you boot an unmodified Linux kernel it gets
stuck in the "Calibrating delay" loop.  The reason for this is that the
vmx code is repeatedly delivering timer interrupts.

Correcting the MILLISECS() and friends macros to return s_time_t instead
of ULL fixes this problem. The other changes are just to get rid of
redundant code and variables.

Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>
xen/arch/x86/vmx_intercept.c
xen/include/xen/time.h

index 4252d923fa10138b996cf3474fc840e1b9e757a8..424f92224d0b2a3f3354321c12ae67b7130a50c6 100644 (file)
@@ -197,8 +197,7 @@ int intercept_pit_io(ioreq_t *p)
 static void pit_timer_fn(void *data)
 {
     struct vmx_virpit_t *vpit = data;
-    s_time_t   next;
-    int        missed_ticks;
+    int missed_ticks;
 
     missed_ticks = (NOW() - vpit->scheduled) / MILLISECS(vpit->period);
 
@@ -208,12 +207,11 @@ static void pit_timer_fn(void *data)
 
     /* pick up missed timer tick */
     if ( missed_ticks > 0 ) {
-        vpit->pending_intr_nr+= missed_ticks;
+        vpit->pending_intr_nr += missed_ticks;
         vpit->scheduled += missed_ticks * MILLISECS(vpit->period);
     }
-    next = vpit->scheduled + MILLISECS(vpit->period);
-    set_ac_timer(&vpit->pit_timer, next);
-    vpit->scheduled = next;
+    vpit->scheduled += MILLISECS(vpit->period);
+    set_ac_timer(&vpit->pit_timer, vpit->scheduled);
 }
 
 
index 88d88039b01ffb4c62cfe2c9a478754d95a17bf1..4c063ef3db4c7a7a4977157e5771c1fca51540d2 100644 (file)
@@ -51,9 +51,9 @@ typedef s64 s_time_t;
 s_time_t get_s_time(void);
 
 #define NOW()           ((s_time_t)get_s_time())
-#define SECONDS(_s)     (((s_time_t)(_s))  * 1000000000ULL )
-#define MILLISECS(_ms)  (((s_time_t)(_ms)) * 1000000ULL )
-#define MICROSECS(_us)  (((s_time_t)(_us)) * 1000ULL )
+#define SECONDS(_s)     ((s_time_t)((_s)  * 1000000000ULL))
+#define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
+#define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 
 extern void update_dom_time(struct vcpu *v);
 extern void do_settime(